MON-4608: add interrupts to NodeExporterCollectorConfig CRD types - #2955
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
Hello @midu16! Some important instructions when contributing to openshift/api: |
|
@midu16: This pull request references MON-4608 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds the disabled-by-default Suggested reviewers: 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
PR Summary by QodoAdd interrupts collector config to ClusterMonitoring NodeExporter CRD
AI Description
Diagram
High-Level Assessment
Files changed (9)
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@config/v1alpha1/types_cluster_monitoring.go`:
- Around line 741-750: Allow an empty Include list as documented by removing the
MinItems=1 validation marker from NodeExporterInterruptsIncludePattern in
config/v1alpha1/types_cluster_monitoring.go:741-750. Regenerate
payload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml:2215-2232
so the CRD no longer enforces a minimum item count.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: ca85e130-9168-465d-a7ab-9487ed4c4c72
⛔ Files ignored due to path filters (7)
config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clustermonitorings.crd.yamlis excluded by!**/zz_generated.crd-manifests/*config/v1alpha1/zz_generated.deepcopy.gois excluded by!**/zz_generated*config/v1alpha1/zz_generated.featuregated-crd-manifests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yamlis excluded by!**/zz_generated.featuregated-crd-manifests/**config/v1alpha1/zz_generated.model_name.gois excluded by!**/zz_generated*config/v1alpha1/zz_generated.swagger_doc_generated.gois excluded by!**/zz_generated*openapi/generated_openapi/zz_generated.openapi.gois excluded by!openapi/**,!**/zz_generated*openapi/openapi.jsonis excluded by!openapi/**
📒 Files selected for processing (2)
config/v1alpha1/types_cluster_monitoring.gopayload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml
Code Review by Qodo
1.
|
everettraven
left a comment
There was a problem hiding this comment.
Overall this looks pretty good. A few comments.
2aa5ff4 to
8021c22
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml (1)
2157-2198: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winAdd test coverage for the new
interruptscollector.This file updates the
netClassandsystemdexpected error messages, but it adds no test cases for the newinterruptscollector. Theinterruptscollector introduces its owncollectionPolicy/collectgate, aminProperties: 1guard oncollect, and anincludelist withminItems,maxItems,maxLength,minLength, and apatternregex constraint. None of these constraints have accept or reject test cases here.Add test cases similar to the existing
netClass/systemdtests, for example:
- Accept
interruptswithcollectionPolicy: Collectandcollect.includeset.- Reject
interruptswithcollectset whencollectionPolicy: DoNotCollect.- Accept
interruptswithcollectionPolicy: DoNotCollectand nocollect.- Reject
interruptswith an emptycollect: {}object.- Reject an
includeentry that violates the^[\x20-\x7E]+$pattern or exceedsmaxLength.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml` around lines 2157 - 2198, Add validation test cases for the new interrupts collector alongside the existing netClass and systemd cases: accept Collect with a populated collect.include list, reject collect under DoNotCollect, accept DoNotCollect without collect, reject an empty collect object, and reject include entries violating the printable-ASCII pattern or maxLength constraint. Use the existing ClusterMonitoring test structure and expected error conventions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml`:
- Around line 2157-2198: Add validation test cases for the new interrupts
collector alongside the existing netClass and systemd cases: accept Collect with
a populated collect.include list, reject collect under DoNotCollect, accept
DoNotCollect without collect, reject an empty collect object, and reject include
entries violating the printable-ASCII pattern or maxLength constraint. Use the
existing ClusterMonitoring test structure and expected error conventions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 200ee26b-ff88-4769-af0f-cc28c5aa6040
⛔ Files ignored due to path filters (7)
config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clustermonitorings.crd.yamlis excluded by!**/zz_generated.crd-manifests/*config/v1alpha1/zz_generated.deepcopy.gois excluded by!**/zz_generated*config/v1alpha1/zz_generated.featuregated-crd-manifests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yamlis excluded by!**/zz_generated.featuregated-crd-manifests/**config/v1alpha1/zz_generated.model_name.gois excluded by!**/zz_generated*config/v1alpha1/zz_generated.swagger_doc_generated.gois excluded by!**/zz_generated*openapi/generated_openapi/zz_generated.openapi.gois excluded by!openapi/**,!**/zz_generated*openapi/openapi.jsonis excluded by!openapi/**
📒 Files selected for processing (3)
config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yamlconfig/v1alpha1/types_cluster_monitoring.gopayload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
- config/v1alpha1/types_cluster_monitoring.go
8021c22 to
0f3afe1
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Scheduling tests matching the |
0f3afe1 to
595800a
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml (1)
2354-2432: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd tests for the remaining
includevalidation rules.These cases do not test the minimum and maximum list size, duplicate patterns, empty patterns, or the 1024-character pattern limit. A regression in these schema constraints will pass this suite.
Add accepted boundary cases and rejected cases for
include: [], 51 entries, duplicate entries, an empty string, and an overlength string. The API contract inconfig/v1alpha1/types_cluster_monitoring.go:799-816defines these constraints.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml` around lines 2354 - 2432, Extend the interrupts collector validation tests around the existing include cases to cover the remaining schema constraints from the include field definition: accepted minimum and maximum list boundaries, and rejected empty lists, 51 entries, duplicate patterns, an empty pattern, and a string exceeding 1024 characters. Keep the expected validation errors aligned with the constraints in the include schema.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml`:
- Around line 2354-2432: Extend the interrupts collector validation tests around
the existing include cases to cover the remaining schema constraints from the
include field definition: accepted minimum and maximum list boundaries, and
rejected empty lists, 51 entries, duplicate patterns, an empty pattern, and a
string exceeding 1024 characters. Keep the expected validation errors aligned
with the constraints in the include schema.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 03602dfd-e9a8-4a66-9ed5-7bd2edf99de2
⛔ Files ignored due to path filters (7)
config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clustermonitorings.crd.yamlis excluded by!**/zz_generated.crd-manifests/*config/v1alpha1/zz_generated.deepcopy.gois excluded by!**/zz_generated*config/v1alpha1/zz_generated.featuregated-crd-manifests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yamlis excluded by!**/zz_generated.featuregated-crd-manifests/**config/v1alpha1/zz_generated.model_name.gois excluded by!**/zz_generated*config/v1alpha1/zz_generated.swagger_doc_generated.gois excluded by!**/zz_generated*openapi/generated_openapi/zz_generated.openapi.gois excluded by!openapi/**,!**/zz_generated*openapi/openapi.jsonis excluded by!openapi/**
📒 Files selected for processing (3)
config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yamlconfig/v1alpha1/types_cluster_monitoring.gopayload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
- config/v1alpha1/types_cluster_monitoring.go
- payload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml
|
/override ci/prow/verify-hypershift-integration Fix pending for this job, but this PR shouldn't affect it anyway |
|
@JoelSpeed: Overrode contexts on behalf of JoelSpeed: ci/prow/verify-hypershift-integration DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
fd9d456 to
194c430
Compare
everettraven
left a comment
There was a problem hiding this comment.
One minor doc update suggestion. Other than that, this LGTM.
simonpasquier
left a comment
There was a problem hiding this comment.
/hold cancel
2 nits otherwise lgtm too
bea3130 to
42ec1d0
Compare
|
Scheduling tests matching the |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: everettraven The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest-required |
Change OverviewCommit: What Changed
Validation Rules
Cluster Environment
Pre-Cluster Test ResultsIntegration Tests (
|
| # | Test Name | Expected | Actual | Result |
|---|---|---|---|---|
| 1 | Create with interrupts Collect + include list | Created | clustermonitoring.config.openshift.io/cluster created |
PASS |
| 2 | Reject interrupts Collect without collect field | Rejected | collect is required when collectionPolicy is Collect, and forbidden otherwise |
PASS |
| 3 | Accept interrupts DoNotCollect without collect | Accepted | configured — spec shows {"collectionPolicy":"DoNotCollect"} |
PASS |
| 4 | Reject interrupts with invalid collectionPolicy | Rejected | Unsupported value: "Invalid": supported values: "Collect", "DoNotCollect" |
PASS |
| 5 | Reject interrupts with empty object (required field) | Rejected | spec.nodeExporterConfig.collectors.interrupts.collectionPolicy: Required value |
PASS |
| 6 | Reject DoNotCollect with collect set | Rejected | collect is required when collectionPolicy is Collect, and forbidden otherwise |
PASS |
| 7 | Reject Collect with empty collect object | Rejected | should have at least 1 properties + include: Required value |
PASS |
| 8 | Accept Collect with wildcard include ".*" |
Accepted | spec shows {"collect":{"include":[".*"]},"collectionPolicy":"Collect"} |
PASS |
| 9 | Reject include with control characters (\t) |
Rejected | must contain only printable ASCII characters (no control characters) |
PASS |
| 10 | Accept full nodeExporterConfig with interrupts + other collectors | Accepted | All collectors and settings persisted correctly | PASS |
| 11 | Accept Collect with multiple include patterns | Accepted | 5 patterns stored: ["LOC.*","NMI.*","RES.*","CAL.*","TLB.*"] |
PASS |
| 12 | Reject empty include list (MinItems=1) | Rejected | should have at least 1 items |
PASS |
| 13 | Reject duplicate include patterns (listType=set) | Rejected | Duplicate value: "LOC.*" |
PASS |
| 14 | Reject include pattern exceeding MaxLength=1024 | Rejected | may not be more than 1024 bytes |
PASS |
| 15 | Accept include pattern at exactly MaxLength=1024 | Accepted | 1024-char pattern stored successfully | PASS |
| 16 | Reject empty include pattern (MinLength=1) | Rejected | should be at least 1 chars long + ASCII validation |
PASS |
| 17 | Reject include list exceeding MaxItems=50 | Rejected | Too many: 51: must have at most 50 items |
PASS |
| 18 | Accept include list at exactly MaxItems=50 | Accepted | 50 patterns stored successfully | PASS |
| 19 | Update from Collect to DoNotCollect | Accepted | spec shows {"collectionPolicy":"DoNotCollect"} |
PASS |
| 20 | Update from DoNotCollect back to Collect with include | Accepted | spec shows include with "LOC.*" |
PASS |
| 21 | Update include patterns (add more) | Accepted | 3 patterns stored: ["LOC.*","NMI.*","RES.*"] |
PASS |
| 22 | Reject update to Collect without collect | Rejected | collect is required when collectionPolicy is Collect, and forbidden otherwise |
PASS |
| 23 | Remove interrupts entirely (leave other collector) | Accepted | Only cpuFreq remains in collectors |
PASS |
| 24 | Verify netClass error message change | Correct | collect may be set when collectionPolicy is Collect, and forbidden otherwise |
PASS |
| 25 | Verify systemd error message change | Correct | collect may be set when collectionPolicy is Collect, and forbidden otherwise |
PASS |
| 26 | Verify valid printable ASCII pattern accepted | Accepted | ["valid-pattern-123.*"] stored |
PASS |
All 26 functional tests: PASS
Reconciliation Stability
Test Methodology
After applying the CRD and creating a ClusterMonitoring CR with interrupts configuration, the resourceVersion of both the CRD and the CR were recorded, then checked after waiting periods.
Results
| Check | CRD resourceVersion | CR resourceVersion | Duration |
|---|---|---|---|
| Before wait | 120045 | 126357 | — |
| After 60 seconds | 120045 | 126357 | 60s |
| After 120 seconds | 120045 | 128449* | 120s |
*Note: The CR resourceVersion changed between the 60s and 120s checks because the test itself applied a new configuration (Test 10+). After the final configuration was applied at resourceVersion 128449, it remained stable for the full 120-second observation window.
Operator Health During Test
| Operator | Available | Progressing | Degraded |
|---|---|---|---|
| config-operator | True | False | False |
| monitoring | True | False | False |
No reconciliation events detected on the CRD.
Result: PASS — The CRD and CR were not reconciled or overwritten by any cluster operator.
Conclusion
All changes introduced by commit 42ec1d006 (MON-4608) pass functional validation:
- Integration tests: 279/279 passed
- Unit tests: All passed
- Codegen verification: Up to date (exit code 0)
- Cluster functional tests: 26/26 passed — all validation rules enforced correctly on a live OCP 4.22.5 cluster
- Reconciliation stability: No drift detected over 120-second observation — CRD and CR stable
- Operator health: config-operator and monitoring operator remain Available and non-Degraded
- Error message updates: netClass and systemd XValidation messages correctly updated
The interrupts collector configuration follows the established union pattern used by other collectors (netClass, systemd), with the additional safety requirement that collect.include is mandatory when collectionPolicy=Collect to prevent uncontrolled metric cardinality.
/verified by @midu16
|
@midu16: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/retest |
|
/retest-required |
|
/test e2e-aws-ovn-hypershift-conformance |
|
@midu16: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
Add
NodeExporterCollectorInterruptsConfigto theNodeExporterCollectorConfigCRD type, enabling users to configure the node-exporterinterruptscollector via theClusterMonitoringCR.
Unlike simpler collectors (softirqs, zoneinfo) that use a plain
collectionPolicyon/off switch, the interrupts collector follows the systemd pattern — a union withcollectionPolicyas the discriminator and an optional
collectsub-struct containing anincludelist of regex patterns. This design matches the CMO implementation on thenode-exporter-collector-interruptsbranch, which passes the include patterns to--collector.interrupts.name-include.Changes
Interruptsfield toNodeExporterCollectorConfigNodeExporterCollectorInterruptsConfig(union:collectionPolicy+collect)NodeExporterCollectorInterruptsCollectConfigwithincludelist (+listType=set, max 50 items)NodeExporterInterruptsIncludePatternvalidated string type (1–1024 chars)collectis forbidden whencollectionPolicyis notCollectCross-reference
node-exporter-collector-interrupts— usesInterrupts.Include []stringinternally;config_merge.gowill translate from this CRD'scollectionPolicy/collect.includeto the internal representation when vendoring.
node-exporter-collector-zoneinfo), extended with the union pattern from the systemd collector.Verification
make update(full regeneration) ✅make build✅make -C config/v1alpha1 test— 262 tests passed ✅make lint— 0 issues ✅